<template>
  <div>
    <!-- 列表区域 -->
    <section>
      <ul>
        <li v-for="(item, index) in list" :key="item.id">
          <span>{{ index + 1 }}</span>
          ---
          <span>{{ item.name }}</span>
          -------
          <button @click="del(item.id)">删除</button>
        </li>
      </ul>
    </section>
  </div>
</template>
<script>
export default {
  name: 'TodoMain',
  props: {
    list: {
      type: Array,
      default: () => []
    },

  },
  data () {
    return {

    }
  },
  created () {
  },
  computed: {
  },
  methods: {
    del(id){
      this.$emit('del',id)
    }
  }
}
</script>
<style   scoped>
ul {
  background-color: skyblue;
}
</style>
